1 <?php
2     include(
"../includes/config.php");
3     session_start();
4     
if(isset($_SESSION['admin_login'])) {
5         
if($_SESSION['admin_login'] == true) {
6             
//select last 5 retialers
7             $query_selectRetailer =
"SELECT * FROM retailer,area WHERE retailer.area_id=area.area_id ORDER BY retailer_id DESC LIMIT 5";
8             $result_selectRetailer = mysqli_query($con,$query_selectRetailer);
9             
//select last 5 manufacturers
10             $query_selectManufacturer =
"SELECT * FROM manufacturer ORDER BY man_id DESC LIMIT 5";
11             $result_selectManufacturer = mysqli_query($con,$query_selectManufacturer);
12             
//select last 5 products
13             $query_selectProducts =
"SELECT * FROM products,categories,unit WHERE products.pro_cat=categories.cat_id AND products.unit=unit.id ORDER BY pro_id DESC LIMIT 5";
14             $result_selectProducts = mysqli_query($con,$query_selectProducts);
15         }
16         
else {
17             header(
'Location:../index.php');
18         }
19     }
20     
else {
21         header(
'Location:../index.php');
22     }
23 ?>
24 <!DOCTYPE html>
25 <html>
26 <head>
27     <title> Admin: Home </title>
28     <link rel=
"stylesheet" href="../includes/main_style.css" >
29 </head>
30 <body>
31     <?php
32         include(
"../includes/header.inc.php");
33         include(
"../includes/nav_admin.inc.php");
34         include(
"../includes/aside_admin.inc.php");
35     ?>
36     <section>
37         <h1>Welcome Admin</h1>
38         <article>
39             <h2>Recently Added Retialers</h2>
40             <table
class="table_displayData">
41                 <tr>
42                     <th>Sr. No.</th>
43                     <th>Username</th>
44                     <th>Area Code</th>
45                     <th>Phone</th>
46                     <th>Email</th>
47                     <th>Address</th>
48                 </tr>
49                 <?php $i=
1; while($row_selectRetailer = mysqli_fetch_array($result_selectRetailer)) { ?>
50                 <tr>
51                     <td> <?php echo $i; ?> </td>
52                     <td> <?php echo $row_selectRetailer[
'username']; ?> </td>
53                     <td> <?php echo $row_selectRetailer[
'area_code']; ?> </td>
54                     <td> <?php echo $row_selectRetailer[
'phone']; ?> </td>
55                     <td> <?php echo $row_selectRetailer[
'email']; ?> </td>
56                     <td> <?php echo $row_selectRetailer[
'address']; ?> </td>
57                 </tr>
58                 <?php $i++; } ?>
59             </table>
60         </article>
61         
62         <article>
63             <h2>Recently Added Manufacturers</h2>
64             <table
class="table_displayData">
65             <tr>
66                 <th>Sr. No.</th>
67                 <th>Name</th>
68                 <th>Email</th>
69                 <th>Phone</th>
70                 <th>Username</th>
71             </tr>
72             <?php $i=
1; while($row_selectManufacturer = mysqli_fetch_array($result_selectManufacturer)) { ?>
73             <tr>
74                 <td> <?php echo $i; ?> </td>
75                 <td> <?php echo $row_selectManufacturer[
'man_name']; ?> </td>
76                 <td> <?php echo $row_selectManufacturer[
'man_email']; ?> </td>
77                 <td> <?php echo $row_selectManufacturer[
'man_phone']; ?> </td>
78                 <td> <?php echo $row_selectManufacturer[
'username']; ?> </td>
79             </tr>
80             <?php $i++; } ?>
81         </table>
82         </article>
83         
84         <article>
85             <h2>Recently Added Products</h2>
86             <table
class="table_displayData">
87             <tr>
88                 <th> Code </th>
89                 <th> Name </th>
90                 <th> Price </th>
91                 <th> Unit </th>
92                 <th> Category </th>
93                 <th> Quantity </th>
94             </tr>
95             <?php $i=
1; while($row_selectProducts = mysqli_fetch_array($result_selectProducts)) { ?>
96             <tr>
97                 <td> <?php echo $row_selectProducts[
'pro_id']; ?> </td>
98                 <td> <?php echo $row_selectProducts[
'pro_name']; ?> </td>
99                 <td> <?php echo $row_selectProducts[
'pro_price']; ?> </td>
100                 <td> <?php echo $row_selectProducts[
'unit_name']; ?> </td>
101                 <td> <?php echo $row_selectProducts[
'cat_name']; ?> </td>
102                 <td> <?php
if($row_selectProducts['quantity'] == NULL){ echo "N/A";} else {echo $row_selectProducts['quantity'];} ?> </td>
103             </tr>
104             <?php $i++; } ?>
105         </table>
106         </article>
107     </section>
108     <?php
109         include(
"../includes/footer.inc.php");
110     ?>
111 </body>
112 </html>


Gõ tìm kiếm nhanh...